import java.util.concurrent.*;

public class BlockingQueueDemo {
    public static void main(String[] args) throws InterruptedException {
//        BlockingQueue<String> queue=new ArrayBlockingQueue<>(10);
//        BlockingQueue<String> queue1=new LinkedBlockingQueue<>(10);
//        BlockingQueue<String> queue2=new PriorityBlockingQueue<>(10);
//        BlockingQueue<String> queue3=new LinkedBlockingDeque<>(10);
//        BlockingQueue<String> queue4=new LinkedTransferQueue<>();

        BlockingQueue<String> queue=new ArrayBlockingQueue<>(3);//最大容量
        queue.put("hello");
        System.out.println("put成功");
        queue.put("hello");
        System.out.println("put成功");

        queue.take();
        System.out.println("take成功");
        queue.take();
        System.out.println("take成功");
        queue.take();
        System.out.println("take成功");



    }
}
